package com.chaopei.customer_server;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

import java.util.logging.Logger;
@SpringBootApplication
//打开消费者模式,Rest+Ribbon
@EnableDiscoveryClient
//@EnableFeignClients
public class CustomerServerApplication {
    static Logger log= Logger.getLogger("consumer");
    public static void main(String[] args) {
        SpringApplication.run(CustomerServerApplication.class, args);
        log.info("消费者已经启动!");
    }
//    通过注解的方式声明一个Bean
    @Bean
    //配置负载(任务)均衡器
    @LoadBalanced
    public RestTemplate getRestTemplate(){
        return  new RestTemplate();
     }
}
